<?php if(!empty($_GET['act']) && ($_GET['act'] == 'myorder')):?>
    <div class="row">
        <h2><b>我的订单</b></h2>
    </div>
    <table class="table row col-md-12 mt20">
        <tr>
            <th class="col-md-2 text-center">宝贝图片</th>
            <th class="col-md-2 text-center">宝贝名称</th>
            <th class="col-md-2 text-center">单价</th>
            <th class="col-md-2 text-center">数量</th>
            <th class="col-md-2 text-center">实付款</th>
            <th class="col-md-2 text-center">状态</th>
        </tr>
        <?php foreach($order_list as $value):?>
            <tr>
                <td colspan="6">
                    订单号:<?php echo $value['ordernum']?>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    订单创建时间:<?php echo $value['create_time']?>
                </td>
            </tr>
            <?php
            //查询订单管理的商品
            $sql = "select * from ".PRE."ordergoods where order_id='".$value['id']."'";
            $order_goods_info = query($link, $sql);
            ?>
            <?php foreach ($order_goods_info as $item):?>
                <?php
                //查询订单管理的商品
                $sql = "select g.id,g.gname,i.iname from ".PRE."goods as g,".PRE."image as i where g.id=i.goods_id and g.id =
'".$item['goods_id']."'and i.cover=1 limit 1";
                $goods_info = getRow($link, $sql);
                ?>
                <tr>
                    <td class="text-center">
                        <a href="<?php echo ROOT_URL?>goods_details.php?id=<?php echo $goods_info['id']?>"><img src="<?php echo get_img_url(ROOT_URL.'upload/',$goods_info['iname'],50)?>"></a>
                    </td>
                    <td class="text-center"><a href="<?php echo ROOT_URL?>goods_details.php?id=<?php echo $goods_info['id']?>"><?php echo $goods_info['gname']?></a></td>
                    <td class="text-center"><?php echo $item['price']?></td>
                    <td class="text-center"><?php echo $item['qty']?></td>
                    <td class="text-center"><?php echo sprintf("%.2f", $item['qty']*$item['price'])?></td>
                    <td class="text-center">
                        <?php echo $value['shipping_status']==0?"未确认":"已确认";?><br>
                        <?php echo $value['pay_status']==0?"未付款":"已付款";?><br>
                        <?php
                        switch($value['order_status']){
                            case 0: echo "未发货"; break;
                            case 1: echo "已发货"; break;
                            case 2: echo "已完成"; break;
                            case 3: echo "已失效"; break;
                        }
                        ?>
                    </td>
                </tr>
            <?php endforeach;?>
            <tr>
                <td colspan="4">&nbsp;</td>
                <td>
                    <?php echo $value['pay_status']==0?"<a href='".ROOT_URL."com/buydo.php?act=delete_order&order_id=".$value['id']."' class='btn btn-primary'>删除订单</a>":''?>

                </td>
                <td>
                    <?php if($value['pay_status']==0):?>
                        <form action="<?php echo ROOT_URL?>com/buydo.php?act=pay" method="post">
                            <input type="hidden" name="order_id" value="<?php echo $value['id']?>">
                            <input type="submit" value="结算" class="btn btn-danger" >
                        </form>
                    <?php endif;?>
                </td>
            </tr>
        <?php endforeach;?>
    </table>
<?php endif;?>